package com.demo.springcloud.alibaba.nacos;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * SpringcloudAlibabaNacosProvider1
 * 
 * @author xiaojianhx
 * @version V1.0.0 $ 2023-11-19 01:18:07 init ---- xiaojianhx
 */
@Controller
@RefreshScope
public class SpringcloudAlibabaNacosProviderController {

    @Autowired
    private Config config;

    @Autowired
    private Environment env;

    @ResponseBody
    @RequestMapping(value = "/echo/{str}")
    public String echo(@PathVariable String str) {
        return "我的端口是：" + env.getProperty("server.port") + ", 配置中心的值是：" + config.getB() + ", 传过来的值是：" + str;
    }
}